package com.pwc.conversionTool.dataAdaptor;

import java.util.ArrayList;
import java.util.List;

public  class DataAdaptor implements IDataAdaptor {
	
	private String[] header;
	
	private List<String[]> content;
	

	public DataAdaptor() {
		super();
	}

	public DataAdaptor(String[] header, List<String[]> content) {
		super();
		this.header = header;
		this.content = content;
	}

	public void setHeader(String[] header) {
		this.header = header;
	}

	@Override
	public void setContent(List<String[]> content) {
		this.content = content;
	}

	@Override
	public String[] getHeader() {
		
		return header;
	}

	@Override
	public List<String[]> getContent() {
		
		return content;
	}

	@Override
	public List<String[]> getAllData() {
		
		ArrayList<String[]> allData=new ArrayList<String[]>(content);
		
		allData.add(0, header);
		
		return allData;
	}
	
	@Override
	public int getColumnIndex(String ColumnName) {
	
		for(int i = 0; i < header.length; i++){
			if(header[i].equals(ColumnName))return i;
		}
		
		return -1;
	}

}
